package com.surprise.cweb.manager;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.surprise.db.dao.SurpriseShopDAO;
import com.surprise.db.entity.SurpriseShop;
import com.surprise.db.repository.SurpriseShopRepository;

/**
 * SurpriseShopManager.java
 * @author xuling
 * @since 2017年9月29日
 */
@Component
public class SurpriseShopManager {

	@Autowired
	private SurpriseShopDAO surpriseShopDAO;

	@Autowired
	private SurpriseShopRepository surpriseShopRepository;
	
	public SurpriseShop add(SurpriseShop surpriseShop) {
	    return surpriseShopRepository.save(surpriseShop);
	}
	
	public void edit(SurpriseShop surpriseShop) {
		surpriseShopRepository.save(surpriseShop);
	}
	
	public SurpriseShop findById(long id) {
		return surpriseShopDAO.findById(id);
	}
	
	public List<SurpriseShop> findAll() {
		return surpriseShopDAO.findAll();
	}
	
	public int deleteById(long id) {
		return surpriseShopDAO.deleteById(id);
	}
}
